{block name=body} 
{* Define the function *} 
{function name=render_files_list level=0} 
	{foreach $items as $item}
		<div class="resource-item">
			
		</div>
	{/foreach} 
{/function}

{function name=render_list level=0}
	{if count($category.files) gt 0} 
		<div class="comm-cat">
		{foreach $category.files as $f}
			<div class="comm-cat">
				{assign var='href_link' value=''}
				{if $f.files_external_link}{assign var='href_link' value=$f.files_external_link}{else}{if $f.files_path}{assign var='href_link' value=$f.files_path}{/if}{/if} 
				{if $href_link}<a href="{$href_link}" target="_blank">{if $f.files_created|date_format:"%Y%m%d" gte "-1 months"|date_format:"%Y%m%d"}<span class="new-badge">New</span>{/if}{$f.files_friendly_name}</a>{/if}
			</div>
		{/foreach}
		</div> 
	{/if}
	{foreach $category.subs as $item}
		{if $item.published eq '1'}
			<div class="comm-cat">
				<h4>{if count($item.files) gt 0}<a href="javascript:void(0)" class="show-hide"><span class="glyphicon glyphicon-plus"></span> {$item.title}</a>{else}{$item.title}{/if}</h4>
				
				{foreach $item.files as $f}
					<div class="comm-cat" style="display:none;">
						{assign var='href_link' value=''}
						{if $f.files_external_link}{assign var='href_link' value=$f.files_external_link}{else}{if $f.files_path}{assign var='href_link' value=$f.files_path}{/if}{/if} 
						{if $href_link}<a href="{$href_link}" target="_blank">{if $f.files_created|date_format:"%Y%m%d" gte "-1 months"|date_format:"%Y%m%d"}<span class="new-badge">New</span>{/if}{$f.files_friendly_name}</a>{/if}
					</div>
				{/foreach} 	
			</div>
		{/if}
	{/foreach} 
{/function}

<div class="row ">
	<h2>{$zone}</h2>
	{foreach $list as $l}{if $category_object_id eq $l.listing_object_id && $l.published eq '1'}{assign var='sublist' value=$l}{break}{/if}{/foreach}
	{call name=render_list category=$sublist}
</div>
{/block}

{block name=tail}
	<script type="text/javascript">

	$('.show-hide').click(function() {
	 	if( $(this).find('span').hasClass('glyphicon-minus')){
	 		$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus'); 
 			$(this).closest('div').find('div').hide();
	 	}else{ 
 			$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus'); 
 			$(this).closest('div').children('div').show();
	 	}
	});
 	
 	</script>
{/block} 